import Vue from 'vue'
// 导入模块
import VueRouter from 'vue-router'
import WorkUser from '@/views/WorkUser/WorkUserIndex'
// import InterviewUser from '@/views/InterviewUser/InterviewUser'
// import outside from '@/views/outside/interviewcard'

Vue.use(VueRouter)
// 动态路由匹配

// 只需添加如下代码即可
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(to) {
  return VueRouterPush.call(this, to).catch(err => err)
}
// 创建路由对象
const router = new VueRouter({
  mode: "history",
  // 配置路由
  routes: [
    // {
    //   path: '/',
    //   redirect: "/userlist",
    //   component: WorkUser,
    //   children: [
    //     {
    //       path: 'userlist',
    //       component: () => import('@/views/WorkUser/WorkUserIndex.vue')
    //     },
    //     {
    //       path: 'userlist/workuser',
    //       component: () => import('@/views/WorkUser/WorkUserIndex.vue')
    //     },
    //     {
    //       path: 'userlist/interviewuser',
    //       component: () => import('@/views/InterviewUser/InterviewUserIndex.vue')
    //     },


    //   ]
    // },
    // 命名路由

    {
      path: '/',
      component: () => import('@/views/index.vue')
    },

    {
      path: '/userlist',
      component: () => import('@/views/WorkUser/WorkUserIndex.vue')
    },

    {
      path: '/userlistm',
      component: () => import('@/views/WorkUserM/WorkUserIndex.vue')
    },


    {
      path: '/interviewcard',
      component: () => import('@/views/outside/InterviewCard.vue')
    },

    {
      path: '/interviewinput',
      component: () => import('@/views/outside/InterviewInput.vue')
    },



    {
      path: '/WorkUserCollect',
      component: () => import('@/views/outside/WorkUserCollect.vue')
    },


    {
      path: '/interviewprint',
      component: () => import('@/views/InterviewUser/InterviewUserCardPrint.vue')
    },

    {
      path: '/interviewuser',
      component: () => import('@/views/InterviewUser/InterviewUserIndex.vue')
    },
    {
      path: '/reserveuser',
      component: () => import('@/views/ReserveUser/ReserveUserIndex.vue')
    },

    {
      path: '/inductionuser',
      component: () => import('@/views/InductionUser/InductionUserIndex.vue')
    },

    {
      path: '/knowledge',
      component: () => import('@/views/KnowledgeBase/KnowledgeIndex.vue')
    },

    {
      path: '/knowledgeeditor',
      component: () => import('@/views/KnowledgeBase/KnowledgeEditor.vue')
    },

    {
      path: '/interviewenter',
      component: () => import('@/views/outside/InterviewEnter.vue')
    },

    {
      path: '/guide',
      component: () => import('@/views/outside/WorkUserGuide.vue')

    },

    {
      path: '/resigninput',
      component: () => import('@/views/Resign/ResignInput.vue')
    },

    {
      path: '/resignread',
      component: () => import('@/views/Resign/ResignRead.vue')
    },

    {
      path: '/award',
      component: () => import('@/views/Award/AwardIndex.vue')
    },
  
    {
      path: '/success',
      component: () => import('@/views/common/success.vue')
    },

    

    {
      path: '/gantt',
      component: () => import('@/views/Gantt/GanttIndex.vue')
    },

    {
      path: '/check',
      component: () => import('@/views/CheckReport/CheckReportIndex.vue')
    },

  ]
})
// 导航守卫
router.beforeEach((to, from, next) => {
  // console.log(to);
  if (to.matched.some(record => record.meta.requireAuth)) {
    // 需要认证
    next('/login')
  } else {
    // ...
    next();
  }
})
export default router;
